{layout name="layout/food" /}
<div class="row-content am-cf">
    <div class="row">
        <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
            <div class="widget am-cf">
                <div class="widget-head am-cf">
                    <div class="widget-title am-cf">用户购物车</div>
                </div>
                <div class="widget-body am-fr">
                    <!-- 工具栏 -->
                    <div class="page_toolbar am-margin-bottom am-cf">
                        <form class="toolbar-form" action="{:url('food.user.cart/index')}">
                            <div class="am-u-sm-12">
                                <div class="am fr">
                                    {if $user['applet']['shop_mode']['value']==20}
                                    <div class="am-form-group am-fl">
                                        <select name="shop_id" data-am-selected="{btnSize: 'sm'}">
                                            <option value="0">全部门店</option>
                                            {if isset($category)}
                                                {foreach $category as $item}
                                                <option value="{$item['shop_id']}" {$item['shop_id'] == $shop_id?'selected':''}>{$item['shop_name']}</option>
                                                {/foreach}
                                            {/if}
                                        </select>
                                    </div>
                                    {/if}
                                    <div class="am-form-group am-fl">
                                        <div class="am-input-group am-input-group-sm tpl-form-border-form">
                                            <input type="text" class="am-form-field" name="search" placeholder="请输入微信昵称、ID、手机号" value="{$search}">
                                            <div class="am-input-group-btn">
                                                <button class="am-btn am-btn-default am-icon-search" type="submit"></button>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </form>
                    </div>
                    <div class="order-list am-scrollable-horizontal am-u-sm-12 am-margin-top-xs">
                        <table width="100%" class="am-table am-table-hover tpl-table-black">
                            <thead>
                            <tr>
                                <th class="goods-detail">商品信息</th>
                                <th width="100px">数量</th>
                                <th>用户</th>
                                <th>门店</th>
                            </tr>
                            </thead>
                            <tbody>
                            {if sizeof($list) > 0}
                                {foreach $list as $item}
                                <tr class="order-empty">
                                    <td colspan="4"></td>
                                </tr>
                                <?php $i = 0;?>
                                {foreach $item['goods'] as $goods}
                                <?php $i++;?>
                                    <tr>
                                        <td class="goods-detail am-text-middle">
                                            <div class="goods-image">
                                                <img src="{$goods['image'][0]['url']}" alt="">
                                            </div>
                                            <div class="goods-info">
                                                <p class="goods-title">{$goods['goods_name']}</p>
                                                <p class="goods-spec am-link-muted">
                                                    
                                                </p>
                                            </div>
                                        </td>
                                        <td class="am-text-middle">
                                            <p>{$goods['goods_num']}</p>
                                        </td>
                                        {if $i === 1}
                                        <?php $goodsCount = count($item['goods']); ?>
                                            <td class="am-text-middle" rowspan="{$goodsCount}">
                                                <p>{$item['user']['nickname']}</p>
                                                <p class="am-link-muted">(用户id：{$item['user']['user_id']})</p>
                                            </td>
                                            <td class="am-text-middle" rowspan="{$goodsCount}">
                                                <p>{$item['shop']['shop_name']}</p>
                                                <p class="am-link-muted">(门店id：{$item['shop']['shop_id']})</p>
                                            </td>
                                        {/if}
                                    </tr>
                                {/foreach}
                                {/foreach}
                            {else /}
                                <tr>
                                    <td colspan="4" class="am-text-center">暂无记录</td>
                                </tr>
                            {/if}
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>